package ltd.hyangyang.rpc.common.bean;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import ltd.hyangyang.rpc.common.constant.RemoteMsgConstant;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Response {

    String requestId;

    String message;

    Object data;

    String msgType;

    public static Response success(Object data,String requestId){
        //调用成功
       return new Response(requestId,"调用成功",data, RemoteMsgConstant.CUSTOM);
    }

    public static Response fail(String requestId){
        return new Response(requestId,"调用远程方法失败",null,RemoteMsgConstant.PONG);
    }

}
